<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>主体页面1</title>
    <link rel="stylesheet" href="<%=basePath%>../css/index1.css">
    <link rel="stylesheet" href="<%=basePath%>../css/changePassword.css"/>
    <script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
    <script src="<%=basePath%>../js/changePassword.js"></script>
</head>
<body>
<!-- 将要删除的id通过隐藏表单域的方式将内容传给后台 -->
<form action="deleteById" method="post" id="deleForm">
    <input type="hidden" name="id" id="sid"/>
</form>
<div>
    <div class="header clearfix">
        <div class="title">EBO测试用</div>
        <div class="add">+</div>
        <div>
            <ul class="nav clearfix">
                <a class="home" href="<%=basePath%>tojump">首页</a>
                <li id="1"><a href="toDemand">需求</a></li>
                <li id="2"><a href="findParams">设置</a></li>
            </ul>
        </div>
    </div>
    <div class="content active">
        <div class="lets">
                <span class="proc">
                    <h2>
                        <a href=""></a>项目设置</h2>
                </span>
            <ul class="let clearfix">
                <li>
                    <a href="#">项目信息</a>
                </li>
                <li>
                    <a href="#">应用设置</a>
                </li>
                <li>
                    <a href="#">成员与权限</a>
                </li>
                <li>
                    <a href="#">消息与报告</a>
                </li>
                <li class="active">
                    <a href="findParams">其他设置</a>
                </li>
                <li class="active">
                    <a href="/updatePassword">修改密码</a>
                </li>
            </ul>
            <form action="/updPassword" method="post" id="psdform">
            <!--修改密码-->
            <div id="base">
                <div id="u0" class="ax_default label">
                    <div id="u0_div" class=""></div>
                    <div id="u0_text" class="text ">
                        <p><span>初始密码：</span></p>
                    </div>
                </div>

                <!-- Unnamed (矩形) -->
                <div id="u1" class="ax_default label">
                    <div id="u1_div" class=""></div>
                    <div id="u1_text" class="text ">
                        <p><span>新密码：</span></p>
                    </div>
                </div>

                <!-- Unnamed (矩形) -->
                <div id="u2" class="ax_default label">
                    <div id="u2_div" class=""></div>
                    <div id="u2_text" class="text ">
                        <p><span>确认密码：</span></p>
                    </div>
                </div>

                <!-- Unnamed (初始密码) -->
                <div id="u3" class="ax_default text_field">
                    <input id="u3_input" type="password" value="" maxlength="18"/>
                </div>

                <!-- Unnamed (新密码) -->
                <div id="u4" class="ax_default text_field">
                    <input id="u4_input" name="newPass" type="password" value="" maxlength="18" />
                </div>

                <!-- Unnamed (确认密码) -->
                <div id="u5" class="ax_default text_field" title="请输入密码与新密码一致">
                    <input id="u5_input" type="password" value="" title="请输入密码与新密码一致" maxlength="18"/>
                </div>
                <!-- Unnamed (提交按钮) -->
                <div id="u6" class="ax_default html_button">
                    <input id="u6_input" type="button" value="提交" onclick="check()"/>
                </div>

                <!-- Unnamed (矩形) -->
                <div id="u7" class="ax_default button">
                    <div id="u7_div" class=""></div>
                    <div id="u7_text" class="text ">
                        <p><span>返回</span></p>
                    </div>
                </div>

            </div>
            </form>
        </div>
    </div>

    <div class="siber">
        <img class="logo" src="./images/jianzhu.png" alt="">
        <a href="#">
            <img src="./images/box.png" alt="">
        </a>
        <a href="#">
            <img src="./images/text.png" alt="">
        </a>
        <a href="#">
            <img src="./images/xiangmu.png" alt="">
        </a>
        <a href="#">
            <img src="./images/lingdang.png" alt="">
        </a>
    </div>

</div>
<script>
    $(document).ready(function () {
        var uls = document.getElementsByClassName('nav');
        console.log($(".nav li"));
        var lis = $(".nav li");
        var contents = document.getElementsByClassName('content');
        for (var i = 0; i < lis.length; i++) {
            lis[i].onclick = function () {
                for (var j = 0; j < contents.length; j++) {
                    contents[j].className = "content";
                }
                contents[this.id - 1].className += ' active';
            };
        }
        //操作函数入口
        $('.operation').click(function () {
            //alert('111');

        });
        if(${requestScope.msg!=null}){
            alert("修改成功,请重新登录");
            location.href="login";
        }

    });
    function deleteById(id){
        document.getElementById("sid").value=id;
        var f=confirm("你确认要删除吗？");
        if(f){
            var deleForm=document.getElementById("deleForm");
            deleForm.submit();
        }
    }

    //页面跳转
    function gotoPage(pageNo) {
        if(pageNo==0){
            document.getElementById("pageNo").value = document.getElementById("inputPage").value;
            document.getElementById("setPageSize").value = document.getElementById("getPageSize").value;
        }else {
            document.getElementById("pageNo").value = pageNo;
        }
        var forms = document.getElementById("setting");
        forms.submit();
    }
    //搜索
    function findSetting() {
        var forms = document.getElementById("setting");
        forms.submit();
    }
    //判断密码
    function check() {
        var odlpsd=document.getElementById("u3_input");
        var nowpsd=document.getElementById("u4_input");
        var ispsd=document.getElementById("u5_input");
        if(odlpsd.value=='' ||  nowpsd.value=='' || ispsd.value=='') {
            alert("请填写完整");
        }else  if(odlpsd.value!='${user.password}'){
            alert("输入的初始密码有误！");
        }else  if(nowpsd.value!=ispsd.value){
            alert("两次新密码输入不一致");
        }else {
            var form = document.getElementById("psdform");
            form.submit();
        }
    }
</script>

</body>

</html>

